﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using NGE;

namespace MH.SE
{
    public partial class ToolBox : UserControl
    {
        Game game;

        public bool CANRCH
        {
            get
            {
                return checkBox1.Checked;
            }
        }

        public int SelectPEN = 1;
        public int SelectFRM
        {
            get
            {
                return trackBar2.Value;
            }
        }

        public ToolBox()
        {
            InitializeComponent();
        }

        private void ToolBox_Load(object sender, EventArgs e)
        {

        }

        public void Init(Game g)
        {
            game = g;
            if (game.Option.Zoom == 1)
            {
                trackBar1.Value = 0;
            }
            else
            {
                trackBar1.Value = (int)Math.Sqrt(game.Option.Zoom);
            }
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            game.Graph.Zoom(trackBar1.Value);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button5.Enabled = button4.Enabled = button1.Enabled = button2.Enabled = button3.Enabled = true;
            SelectPEN = 0;
            button1.Enabled = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            button5.Enabled = button4.Enabled = button1.Enabled = button2.Enabled = button3.Enabled = true;
            SelectPEN = 1;
            button2.Enabled = false;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            button5.Enabled = button4.Enabled = button1.Enabled = button2.Enabled = button3.Enabled = true;
            SelectPEN = 2;
            button3.Enabled = false;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            button5.Enabled = button4.Enabled = button1.Enabled = button2.Enabled = button3.Enabled = true;
            SelectPEN = 3;
            button4.Enabled = false;

        }

        private void button5_Click(object sender, EventArgs e)
        {
            button5.Enabled = button4.Enabled = button1.Enabled = button2.Enabled = button3.Enabled = true;
            SelectPEN = 4;
            button5.Enabled = false;
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            SECOM secom = (SECOM)game.GetComponent(typeof(SECOM));
            secom.IsShowExtendTile = checkBox2.Checked;
        }
    }
}
